import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router'
import Layout from '../Layout.vue'

const router = createRouter({
  // history: createWebHistory(import.meta.env.BASE_URL),
  history: createWebHashHistory(),
  routes: [
    {
      path:'/',
      redirect: '/home'
    },
    {
      path: '/',
      name: 'layout',
      component: Layout,
      alias: '/layout',
      children: [
        {
          path: 'home',
          name: 'home',
          component: () => import('../views/HomeView.vue')
        },
        {
          path: 'user_list',
          name: 'user_list',
          component: () => import('../views/user/ListView.vue')
        },
        {
          path: 'banner_add',
          name: 'banner_add',
          component: () => import('../views/banner/AddView.vue')
        },
        {
          path: 'banner_list',
          name: 'banner_list',
          component: () => import('../views/banner/ListView.vue')
        },
        {
          path: 'navi_add',
          name: 'navi_add',
          component: () => import('../views/navi/AddView.vue')
        },
        {
          path: 'navi_list',
          name: 'navi_list',
          component: () => import('../views/navi/ListView.vue')
        },
        {
          path: 'category',
          name: 'category',
          component: () => import('../views/exam/Category.vue')
        },
        {
          path: 'test_paper',
          name: 'test_paper',
          component: () => import('../views/exam/TestPaper.vue')
        },
        {
          path: 'topic',
          name: 'topic',
          component: () => import('../views/exam/Topic.vue')
        },
        {
          path: 'topic_list',
          name: 'topic_list',
          component: () => import('../views/exam/TopicList.vue')
        },
        {
          path: 'score',
          name: 'score',
          component: () => import('../views/exam/Score.vue')
        },
        {
          path: 'setting',
          name: 'setting',
          component: () => import('../views/SetView.vue')
        },

        // 面试题模块
        {
          path: 'interview_category',
          name: 'interview_category',
          component: () => import('../views/interview/InterviewCategory.vue')
        },
        {
          path: 'interview_menu',
          name: 'interview_menu',
          component: () => import('../views/interview/InterviewMenu.vue')
        },
        {
          path: '/interview_topic',
          name: 'interview_topic',
          component: () => import('../views/interview/InterviewTopic.vue')
        },

      ]
    },

    {
      path: '/login',
      name: 'login',
      component: () => import('../views/LoginView.vue')
    },
    {
      path: '/admin',
      name: 'admin',
      component: () => import('../views/AdminView.vue')
    },
    {
      path: '/findpwd',
      name: 'findpwd',
      component: () => import('../views/FindPwd.vue')
    },
   // 配置404... NotFound （在数组的末位）
    {
      // path:'*', vue2
      path: "/:pathMatch(.*)*",
      name: 'error',
      component: () => import('../views/ErrorView.vue')
    }
    
  ]
})

export default router
